namespace Hrm.EntityFramework.MigrationsStudio
{
    using System;
    using System.Data.Entity.Migrations;
    
    public partial class Initial : DbMigration
    {
        public override void Up()
        {
            CreateTable(
                "dbo.BlogComments",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        EvaluateUser = c.String(maxLength: 50),
                        CommentText = c.String(maxLength: 2000),
                        IsEnable = c.Boolean(nullable: false),
                        CreateDatetime = c.DateTime(),
                        CreateUserCode = c.String(maxLength: 50),
                        UpdateDatetime = c.DateTime(),
                        UpdateUserCode = c.String(maxLength: 50),
                        BlogComment_Id = c.Int(),
                        BlogPost_Id = c.Int(),
                    })
                .PrimaryKey(t => t.Id)
                .ForeignKey("dbo.BlogComments", t => t.BlogComment_Id)
                .ForeignKey("dbo.BlogPosts", t => t.BlogPost_Id)
                .Index(t => t.BlogComment_Id)
                .Index(t => t.BlogPost_Id);
            
            CreateTable(
                "dbo.BlogPosts",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        Title = c.String(maxLength: 50),
                        Description = c.String(maxLength: 2000),
                        Type = c.String(maxLength: 50),
                        Content = c.String(),
                        Tags = c.String(maxLength: 50),
                        IsEnable = c.Boolean(nullable: false),
                        CreateDatetime = c.DateTime(),
                        CreateUserCode = c.String(maxLength: 50),
                        UpdateDatetime = c.DateTime(),
                        UpdateUserCode = c.String(maxLength: 50),
                    })
                .PrimaryKey(t => t.Id);
            
            CreateTable(
                "dbo.BlogTags",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        Name = c.String(maxLength: 50),
                        IsEnable = c.Boolean(nullable: false),
                        CreateDatetime = c.DateTime(),
                        CreateUserCode = c.String(maxLength: 50),
                        UpdateDatetime = c.DateTime(),
                        UpdateUserCode = c.String(maxLength: 50),
                    })
                .PrimaryKey(t => t.Id);
            
            CreateTable(
                "dbo.Emails",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        Name = c.String(nullable: false, maxLength: 50),
                        EmailNum = c.String(nullable: false, maxLength: 50),
                        Ip = c.String(maxLength: 50),
                        Phone = c.String(maxLength: 50),
                        Subject = c.String(nullable: false, maxLength: 50),
                        Body = c.String(nullable: false, maxLength: 2000),
                        IsEnable = c.Boolean(nullable: false),
                        CreateDatetime = c.DateTime(),
                        CreateUserCode = c.String(maxLength: 50),
                        UpdateDatetime = c.DateTime(),
                        UpdateUserCode = c.String(maxLength: 50),
                    })
                .PrimaryKey(t => t.Id);
            
            CreateTable(
                "dbo.Images",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        Name = c.String(maxLength: 50),
                        Description = c.String(maxLength: 2000),
                        DelongId = c.Int(nullable: false),
                        DelongType = c.String(maxLength: 50),
                        Type = c.String(maxLength: 50),
                        Url = c.String(maxLength: 1000),
                        IsEnable = c.Boolean(nullable: false),
                        CreateDatetime = c.DateTime(),
                        CreateUserCode = c.String(maxLength: 50),
                        UpdateDatetime = c.DateTime(),
                        UpdateUserCode = c.String(maxLength: 50),
                    })
                .PrimaryKey(t => t.Id);
            
            CreateTable(
                "dbo.Portfolios",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        Name = c.String(maxLength: 50),
                        Description = c.String(maxLength: 2000),
                        Type = c.String(maxLength: 50),
                        FinishDate = c.DateTime(nullable: false),
                        SkillsUsed = c.String(maxLength: 50),
                        DemoUrl = c.String(maxLength: 1000),
                        IsEnable = c.Boolean(nullable: false),
                        CreateDatetime = c.DateTime(),
                        CreateUserCode = c.String(maxLength: 50),
                        UpdateDatetime = c.DateTime(),
                        UpdateUserCode = c.String(maxLength: 50),
                    })
                .PrimaryKey(t => t.Id);
            
            CreateTable(
                "dbo.PriceItems",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        Name = c.String(maxLength: 50),
                        Glyphicon = c.String(maxLength: 50),
                        IsEnable = c.Boolean(nullable: false),
                        CreateDatetime = c.DateTime(),
                        CreateUserCode = c.String(maxLength: 50),
                        UpdateDatetime = c.DateTime(),
                        UpdateUserCode = c.String(maxLength: 50),
                        PriceItems_Id = c.Int(),
                    })
                .PrimaryKey(t => t.Id)
                .ForeignKey("dbo.PriceTypes", t => t.PriceItems_Id)
                .Index(t => t.PriceItems_Id);
            
            CreateTable(
                "dbo.PriceTypes",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        Name = c.String(maxLength: 50),
                        Description = c.String(maxLength: 2000),
                        BelongId = c.Int(nullable: false),
                        BelongType = c.String(maxLength: 50),
                        Price = c.Decimal(nullable: false, precision: 18, scale: 2),
                        Unit = c.String(maxLength: 50),
                        IsEnable = c.Boolean(nullable: false),
                        CreateDatetime = c.DateTime(),
                        CreateUserCode = c.String(maxLength: 50),
                        UpdateDatetime = c.DateTime(),
                        UpdateUserCode = c.String(maxLength: 50),
                    })
                .PrimaryKey(t => t.Id);
            
            CreateTable(
                "dbo.Services",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        Name = c.String(maxLength: 50),
                        Description = c.String(maxLength: 1000),
                        Glyphicon = c.String(maxLength: 50),
                        IsEnable = c.Boolean(nullable: false),
                        CreateDatetime = c.DateTime(),
                        CreateUserCode = c.String(maxLength: 50),
                        UpdateDatetime = c.DateTime(),
                        UpdateUserCode = c.String(maxLength: 50),
                    })
                .PrimaryKey(t => t.Id);
            
            CreateTable(
                "dbo.Skills",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        Title = c.String(maxLength: 50),
                        Percent = c.Single(nullable: false),
                        IsEnable = c.Boolean(nullable: false),
                        CreateDatetime = c.DateTime(),
                        CreateUserCode = c.String(maxLength: 50),
                        UpdateDatetime = c.DateTime(),
                        UpdateUserCode = c.String(maxLength: 50),
                        TeamMenber_Id = c.Int(),
                    })
                .PrimaryKey(t => t.Id)
                .ForeignKey("dbo.TeamMenbers", t => t.TeamMenber_Id)
                .Index(t => t.TeamMenber_Id);
            
            CreateTable(
                "dbo.TeamMenbers",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        ChineseName = c.String(maxLength: 50),
                        EnglishName = c.String(maxLength: 50),
                        Type = c.String(maxLength: 50),
                        UserImg = c.String(maxLength: 100),
                        Company = c.String(maxLength: 100),
                        Position = c.String(maxLength: 50),
                        Description = c.String(maxLength: 2000),
                        OrderNum = c.Int(nullable: false),
                        IsEnable = c.Boolean(nullable: false),
                        CreateDatetime = c.DateTime(),
                        CreateUserCode = c.String(maxLength: 50),
                        UpdateDatetime = c.DateTime(),
                        UpdateUserCode = c.String(maxLength: 50),
                    })
                .PrimaryKey(t => t.Id);
            
        }
        
        public override void Down()
        {
            DropForeignKey("dbo.Skills", "TeamMenber_Id", "dbo.TeamMenbers");
            DropForeignKey("dbo.PriceItems", "PriceItems_Id", "dbo.PriceTypes");
            DropForeignKey("dbo.BlogComments", "BlogPost_Id", "dbo.BlogPosts");
            DropForeignKey("dbo.BlogComments", "BlogComment_Id", "dbo.BlogComments");
            DropIndex("dbo.Skills", new[] { "TeamMenber_Id" });
            DropIndex("dbo.PriceItems", new[] { "PriceItems_Id" });
            DropIndex("dbo.BlogComments", new[] { "BlogPost_Id" });
            DropIndex("dbo.BlogComments", new[] { "BlogComment_Id" });
            DropTable("dbo.TeamMenbers");
            DropTable("dbo.Skills");
            DropTable("dbo.Services");
            DropTable("dbo.PriceTypes");
            DropTable("dbo.PriceItems");
            DropTable("dbo.Portfolios");
            DropTable("dbo.Images");
            DropTable("dbo.Emails");
            DropTable("dbo.BlogTags");
            DropTable("dbo.BlogPosts");
            DropTable("dbo.BlogComments");
        }
    }
}
